/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn;

import com.alibaba.fastjson.JSON;
import org.junit.jupiter.api.Test;

import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>Project: javaweb - Demo
 * <p>Powered by webrx On 2022-03-14 16:40:13
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Demo {




    @Test
    public void m1(){
        //java object
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("id",66);
        map.put("name","张三丰");
        map.put("age",18);
        map.put("birth", LocalDate.now());
        map.put("money",80);
        map.put("love",new String[]{"java","mysql","javascript","html"});
        System.out.println(map);

        //java object 转换为 json字符串
        System.out.println(JSON.toJSON(map));


        Student stu  = new Student(99,"赵强","河南省郑州");
        System.out.println(stu);

        System.out.println(JSON.toJSON(stu));

    }
}
